using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(AudioStudio.AkEnvironment)), CanEditMultipleObjects]
public class AkEnvironmentInspector : Editor
{
    AudioStudio.AkEnvironment component;

    SerializedProperty m_auxBusId;
    SerializedProperty m_priority;
    SerializedProperty m_isDefault;
    SerializedProperty m_excludeOthers;

    void OnEnable()
    {
        component = target as AudioStudio.AkEnvironment;

        m_auxBusId = serializedObject.FindProperty("m_auxBusID");
        m_priority = serializedObject.FindProperty("priority");
        m_isDefault = serializedObject.FindProperty("isDefault");
        m_excludeOthers = serializedObject.FindProperty("excludeOthers");

    }

    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.BeginVertical("Box");
        {
            m_priority.intValue = EditorGUILayout.IntField("Priority: ", m_priority.intValue);

            GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);

            m_isDefault.boolValue = EditorGUILayout.Toggle("Default: ", m_isDefault.boolValue);
            if (m_isDefault.boolValue)
                m_excludeOthers.boolValue = false;

            GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);

            m_excludeOthers.boolValue = EditorGUILayout.Toggle("Exclude Others: ", m_excludeOthers.boolValue);
            if (m_excludeOthers.boolValue)
                m_isDefault.boolValue = false;
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.LabelField("Aux Bus:");
        //AudioScriptGUI.DrawList(serializedObject.FindProperty("auxBus"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("auxBus"), GUIContent.none);
        serializedObject.ApplyModifiedProperties();
    }
}